package com.OrderingServer.service.impl;

import com.OrderingServer.mapper.LoginlogMapper;
import com.OrderingServer.pojo.Loginlog;
import com.OrderingServer.pojo.ProductCategory;
import com.OrderingServer.service.ILoginlogService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 * @author bruce
 */
@Service
public class LoginlogServiceImpl extends ServiceImpl<LoginlogMapper, Loginlog> implements ILoginlogService {
@Autowired
private LoginlogMapper loginlogMapper;
    @Override
    public PageInfo<Loginlog> selectPage(Integer pageNum, Integer pageSize, String userName) {
        //设置分页插件
        PageHelper.startPage(pageNum, pageSize);
        //正常查询，查询数据
        QueryWrapper<Loginlog> queryWrapper = new QueryWrapper<Loginlog>();
        List<Loginlog> list = loginlogMapper.selectList(new QueryWrapper<Loginlog>().eq("name", userName));
        return PageInfo.of(list);
    }

    @Override
    public List<Loginlog> selectLoginlogByname(String username) {
        return loginlogMapper.selectLoginlogByname(username);
    }
}
